﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace StudioLive
{
    public partial class presentation : Form
    {
        public presentation()
        {
            InitializeComponent();
        }

        private void mediaPlayer1_PlayStateChange(object sender, AxWMPLib._WMPOCXEvents_PlayStateChangeEvent e)
        {
            if (e.newState == 8)
            {
                // Media ended
                if (vars.goToScriptNumber != 0)
                {
                    vars.mainForm.proceedMedia();
                }
            }
        }

        private void mediaPlayer2_PlayStateChange(object sender, AxWMPLib._WMPOCXEvents_PlayStateChangeEvent e)
        {
            if (e.newState == 8)
            {
                // Media ended
                if (vars.goToScriptNumber != 0)
                {
                    vars.mainForm.proceedMedia();
                }
            }
        }

        private void backupMediaPlayer_PlayStateChange(object sender, AxWMPLib._WMPOCXEvents_PlayStateChangeEvent e)
        {
            if (e.newState == 8)
            {
                // Media ended
                if (vars.goToScriptNumber != 0)
                {
                    vars.mainForm.proceedMedia();
                }
            }
        }

        private void presentation_Load(object sender, EventArgs e)
        {
            Bitmap bm = new Bitmap(Directory.GetParent(Application.ExecutablePath).ToString() + "/" + vars.backgroundSource);
            this.BackgroundImage = new Bitmap(bm);
        }
    }
}
